﻿using MiddlewareCore.Middleware;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MiddlewareCore.Application
{
    public interface IApplicationBuilder : IDisposable
    {
        /// <summary>
        /// 中間件管道执行
        /// 执行此函数时，代表您已加入所有待执行中间件
        /// 所有中间件只初始化一次
        /// </summary>
        Task Work<T>(MiddlewareContext<T> context);
        /// <summary>
        /// 添加中间件
        /// </summary>
        /// <param name="middleware"></param>
        IApplicationBuilder Use(Func<RequestDelegate, RequestDelegate> middleware);
    }
}
